#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>

int digits[35] = { 0 };
int main()
{
	long long int digit = 0;
	int n = 0, i = 0;
	while (scanf("%d", &digits[n])!=EOF) { n++;  }
	n = pow(2, n - 1);
	while (digits[i] != 0) {
		digit += digits[i] * n;
		i++;
	}
	printf("%lld", digit);
	return 0;
}